Component({
  externalClasses: ['custom-class'],
  properties: {
    category: {
      type: Array,
    },
    activeTab: {
      type: Number,
    },
    activeKey: {
      type: Number,
    },
  },
  data: {
    showTab: true,
    showPopup: false, // 是否显示弹出层
    // tabid: 'tab3'
  },
  methods: {
    // 当切换左侧tab时，重置二级tab滚动位置
    reRenderTab() {
      this.setData({
        showTab: false,
        showPopup: false, // 是否显示弹出层
      })
      setTimeout(() => {
        this.setData({ showTab: true })
      })
    },
    // 点击tab时向父组件触发事件传值
    getViewId(e) {
      // this.createSelectorQuery().selectAll('.van-tabs__scroll').boundingClientRect(function (res) {
      //   console.log(res)
      //   }).exec()
      this.triggerEvent('getViewId', e.detail.name);
    },
    handleSelect(event){
      const { index } = event.currentTarget.dataset;
      this.setData({ showPopup: false })
      this.triggerEvent('getViewId', index);
    },
    handleArrowShow(){
      this.setData({ showPopup: !this.data.showPopup })
    },
  },
})
